package cron_job

import (
	"github.com/robfig/cron/v3"
	"nearby/biz/config"
)

var taskRegister = map[string]Task{
	"sync_moment_view_cnt": SyncMomentViewCntTask{},
}

func InitCronJob() {
	c := cron.New()
	for _, task := range taskRegister {
		if config.IsDebugMode() {
			_, _ = c.AddFunc(task.SpecDebugMode(), task.Handle)
		} else {
			_, _ = c.AddFunc(task.Spec(), task.Handle)
		}
	}
	c.Start()
}
